#include <QtCore>
#include <QTranslator>
#include "myapp.h"
#include "MyForm.h"

int main(int argc, char *argv[])
{
	MyApp app(argc, argv);
	// find if application already running
	// if it is running, it has already send args to its running instance, so we just exit
	if ( app.alreadyRunning ) return 0;
	qDebug() << app.pluginsDirs();
	MyForm mainf;
#ifndef NOSINGLEAPP
	QObject::connect(app.getInstance(), SIGNAL(messageReceived(QString)), &mainf, SLOT(setPreview(QString))); // I should create specific slot, I think
#endif //NOSINGLEAPP
	mainf.show();
	for(int i = 1; i < argc; i++) //we don't need first arg
	{
		mainf.setPreview(QString::fromLocal8Bit(argv[i])); // treat cmdline args as image names
		qDebug() << QString::fromLocal8Bit(argv[i]);
	}
	return app.exec();
}
